﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;

namespace EntryExit
{
    public partial class LowWorkHours : DevExpress.XtraReports.UI.XtraReport
    {
        public LowWorkHours(DataTable data, string reportSubject, bool weeklyreport)
        {
            InitializeComponent();
            ClearDataContext();

            lblRptHead.Text = reportSubject;
            if (data != null)
            {
                BindLabels(data, weeklyreport);
            }
        }





        private void BindLabels(DataTable data, bool weeklyreport)
        {
            this.DataSource = data;

            XRBinding bindingSlNo = new XRBinding();
            XRBinding bindingLPN = new XRBinding();
            XRBinding bindingName = new XRBinding();
            XRBinding bindingDate = new XRBinding();
            XRBinding bindingHours = new XRBinding();

            bindingSlNo = new XRBinding("Text", data, "SLNo");
            bindingLPN = new XRBinding("Text", data, "LPN");
            bindingName = new XRBinding("Text", data, "EmployeeName");
            if (!weeklyreport)
            {
                bindingDate = new XRBinding("Text", data, "TransactionDate");
                bindingHours = new XRBinding("Text", data, "Timeinoffice");
            }
            else
            {
                bindingDate = new XRBinding("Text", data, "Timeinoffice");
            }

            

            lblDataSlNo.DataBindings.Add(bindingSlNo);
            lblDataLpn.DataBindings.Add(bindingLPN);
            lblDataName.DataBindings.Add(bindingName);
            if (!weeklyreport)
            {
                lblDataDate.DataBindings.Add(bindingDate);
                lblDataHours.DataBindings.Add(bindingHours);
            }
            else
            {
                lblDataDate.DataBindings.Add(bindingDate);
                lblDataHours.Visible = false;
                xrTableCell5.Visible = false;
            }
            



        }
    }
}
